import { createRouter, createWebHistory, createWebHashHistory} from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView,
      redirect: '/login'
    },
    {
      path: '/about',
      name: 'about',
      component: () => import('../views/AboutView.vue')
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/Login/index.vue')
    },
    {
      path: '/encyclopedia',
      name: 'encyclopedia',
      component: () => import('../views/encyclopedia.vue')
    },
    {
      path: '/information',
      name: 'information',
      component: () => import('../views/information.vue')
    },
    {
      path: '/my',
      name: 'my',
      component: () => import('../views/my.vue')
    }
  ]
})
router.beforeEach((to,from,next)=>{
 
//     if(!localStorage.getItem('token')){
//       next('/')
//     }else {
//       next()
// }

})

export default router
